<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>TZ-追梦</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        html,body{
            height: 100%;
        }
    </style>
</head>
<body>

    <script>
        var r = 235;
        var g = 0;
        var b = 0;
        //document.body.style.background = 'rgb('+r+','+g+','+b+')';
        auto();
        function auto() {
            var timer = setInterval(function () {
                b ++;
                change();
                if(b===235){
                    clearInterval(timer);
                    timer = setInterval(function () {
                        r --;
                        change();
                        if( r===0 ){
                            clearInterval(timer);
                            timer = setInterval(function () {
                                g++;
                                change();
                                if( g===235 ){
                                    clearInterval(timer);
                                    timer = setInterval(function () {
                                        b --;
                                        change();
                                        if( b===0 ){
                                            clearInterval(timer);
                                            timer = setInterval(function () {
                                                r ++;
                                                change();
                                                if( r === 235 ){
                                                    clearInterval(timer);
                                                    timer = setInterval(function () {
                                                        g--;
                                                        change();
                                                        if( g===0 ){
                                                            clearInterval(timer);
                                                            timer = setInterval(function () {
                                                                clearInterval(timer);
                                                                auto();
                                                            },13)
                                                        }

                                                    },13)
                                                }
                                            },13);
                                        }
                                    },13)
                                }
                            },13)
                        }
                    },13);

                }
            },13);
        }
        change();
        function change() {
            var R = g,G = b,B = r;
            var color1 = 'rgb('+r+','+g+','+b+')';
            var color2 = 'rgb('+R+','+G+','+B+')';
            document.body.style.background = '-webkit-gradient(linear,left top,right bottom,from('+color1+'),to('+color2+'))';
            document.body.style.background = '-moz-linear-gradient(left top,'+color1+' 0%,'+color2+' 100%)';
        }


        /*
        *   r = 235
        *   g = 0
        *   b ++
        *   else if( b==235&&r==235&&g==0 ){
        *       clearInterval(timer)
        *       r --;
        *       g = 0;
        *       b = 235
        *   }else if( r==0&&g==0&&b=235 ){
        *       g++;
        *       b =235
        *       r=0
        *   }else if( g==235&&b==235&&r==0 ){        *
        *       b --
        *       g=235
        *       r =0
        *   }
        *
        *
        *
        *
        *
        *
        *
        *
        *
        *
        *
        *
        *
        *
        *
        *
        *
        *
        *
        * */
    </script>
</body>
</html>